package gui.visu.listeners;


import com.visutools.nav.bislider.BiSliderEvent;
import com.visutools.nav.bislider.BiSliderListener;

import controls.DataControl;
import data.Constants;

/**
 * @author Charles Perin
 * 29 mars 2011
 * LIMSI - INRIA Rennes
 * charles.perin@free.fr
 *
 */
public class ListenerTravelInTimeBiSlider implements BiSliderListener{

	private DataControl dataControl;

	public ListenerTravelInTimeBiSlider(DataControl dataControl){
		setDataControl(dataControl);
	}

	@Override
	public void prepareJumpValues(BiSliderEvent BiSliderEvent_Arg) {

	}

	@Override
	public void notifyJumpValues(BiSliderEvent BiSliderEvent_Arg) {

	}

	@Override
	public void newValues(BiSliderEvent BiSliderEvent_Arg) {
		int newXMinView = (int) BiSliderEvent_Arg.getMinimumColored();
		int newXMaxView = (int) BiSliderEvent_Arg.getMaximumColored();
		if(newXMaxView-newXMinView>Constants.MIN_FRAMES_ON_SCREEN ){
			if(dataControl!=null){
				dataControl.getDisplayDataList().setXView((int)BiSliderEvent_Arg.getMinimumColored(), (int)BiSliderEvent_Arg.getMaximumColored());
				if(dataControl.getIhm().getTimePane().getControler()!=null)dataControl.updateVisuPane();
			}
		}
	}

	@Override
	public void newSegments(BiSliderEvent BiSliderEvent_Arg) {

	}

	@Override
	public void newMinValue(BiSliderEvent BiSliderEvent_Arg) {

	}

	@Override
	public void newMin(BiSliderEvent BiSliderEvent_Arg) {

	}

	@Override
	public void newMaxValue(BiSliderEvent BiSliderEvent_Arg) {

	}

	@Override
	public void newMax(BiSliderEvent BiSliderEvent_Arg) {

	}

	@Override
	public void newGlobalRange(BiSliderEvent BiSliderEvent_Arg) {

	}

	@Override
	public void newColors(BiSliderEvent BiSliderEvent_Arg) {

	}

	public DataControl getDataControl() {
		return dataControl;
	}

	public void setDataControl(DataControl dataControl) {
		this.dataControl = dataControl;
	}

}
